//转为大写
const ToUpperCase = str => {
    return str.toUpperCase();
}

//转为小写
const ToLowerCase = str => {
    return str.toLowerCase();
}

//转为大驼峰
const ToBigCamelCase = str => {
    let arr = str.split(/[,_-\s]/);
    if (arr.length > 0) {
        for (let i = 0; i < arr.length; i++) {
            if (arr[i].length > 0) {
                let temp = arr[i].toLowerCase();
                arr[i] = temp.charAt(0).toUpperCase() + temp.substring(1);
            }
        }
    }
    return arr.join("");
}

//转为小驼峰
const ToSmallCamelCase = str => {
    let firstWord = true;
    let arr = str.split(/[,_-\s]/);
    if (arr.length > 0) {
        for (let i = 0; i < arr.length; i++) {
            if (arr[i].length > 0) {
                if (firstWord) {
                    arr[i] = arr[i].toLowerCase();
                    firstWord = false;
                } else {
                    let temp = arr[i].toLowerCase();
                    arr[i] = temp.charAt(0).toUpperCase() + temp.substring(1);
                }
            }
        }
    }
    return arr.join("");
}

module.exports = {
    ToUpperCase,
    ToLowerCase,
    ToBigCamelCase,
    ToSmallCamelCase
}